//
//  BzVC+UI.swift
//  Auscultation
//
//  Created by 来 on 2020/12/13.
//

import Foundation

extension BzVC {
    
    func initUI() {
        
        let back_view = UIView.init()
        view.addSubview(back_view)
        back_view.snp.makeConstraints { (make) in
            make.top.bottom.right.equalToSuperview()
            make.left.equalTo(UIDevice.lgf_IsIphoneX() ? 40 : 0)
        }
        
        let top_view = UIView.init()
        top_view.backgroundColor = UIColor.white
        back_view.addSubview(top_view)
        top_view.snp.makeConstraints { (make) in
            make.top.left.right.equalToSuperview()
            make.height.equalTo(44)
        }
        
        let back_b = UIView.init()
        back_b.lgf_AddTap(target: self, action: #selector(BzVC.s_back))
        top_view.addSubview(back_b)
        back_b.snp.makeConstraints { (make) in
            make.top.bottom.left.equalToSuperview()
            make.width.equalTo(32)
        }
        let back = UIImageView.init(image: #imageLiteral(resourceName: "返回"))
        back_b.addSubview(back)
        back.snp.makeConstraints { (make) in
            make.center.equalToSuperview()
            make.width.equalTo(10)
            make.height.equalTo(14)
        }
        ys = UILabel.init()
        ys.text = EWEUser.lgf.realName ?? ""
        ys.font = UIFont.systemFont(ofSize: 16)
        ys.textColor = UIColor.init(lgf_HexString: "222222")
        ys.isUserInteractionEnabled = true
        top_view.addSubview(ys)
        ys.snp.makeConstraints { (make) in
            make.left.equalTo(back.snp.right).offset(15)
            make.top.bottom.equalToSuperview()
        }
        
        add_dbys = UILabel.init()
        add_dbys.isUserInteractionEnabled = true
        add_dbys.layer.borderColor = UIColor.init(lgf_HexString: "8FC6F6")?.cgColor
        add_dbys.layer.borderWidth = 1.0
        add_dbys.layer.cornerRadius = 4
        add_dbys.clipsToBounds = true
        add_dbys.text = "+ 对比医生"
        add_dbys.textColor = UIColor.init(lgf_HexString: "0F88F2")
        add_dbys.font = UIFont.systemFont(ofSize: 15)
        add_dbys.textAlignment = .center
        add_dbys.lgf_AddTap(target: self, action: #selector(BzVC.s_add_dbys))
        top_view.addSubview(add_dbys)
        add_dbys.snp.makeConstraints { (make) in
            make.right.equalToSuperview().offset(-25)
            make.height.equalToSuperview().offset(-15)
            make.centerY.equalToSuperview()
            make.width.equalTo(100)
        }
        
        qhsp2 = UILabel.init()
        qhsp2.isUserInteractionEnabled = true
        qhsp2.layer.borderColor = UIColor.init(lgf_HexString: "8FC6F6")?.cgColor
        qhsp2.layer.borderWidth = 1.0
        qhsp2.layer.cornerRadius = 4
        qhsp2.clipsToBounds = true
        qhsp2.text = "切换至SP"
        qhsp2.textColor = UIColor.init(lgf_HexString: "0F88F2")
        qhsp2.font = UIFont.systemFont(ofSize: 13)
        qhsp2.textAlignment = .center
        qhsp2.lgf_AddTap(target: self, action: #selector(BzVC.s_qhsp(_:)))
        top_view.addSubview(qhsp2)
        qhsp2.snp.makeConstraints { (make) in
            make.right.equalTo(add_dbys.snp.left).offset(-10)
            make.height.equalToSuperview().offset(-15)
            make.centerY.equalToSuperview()
            make.width.equalTo(70)
        }
        
        dbys_b = UIScrollView.init()
        if #available(iOS 11.0, *) {
            dbys_b.contentInsetAdjustmentBehavior = .never
        } else {
            self.automaticallyAdjustsScrollViewInsets = false
        }
        top_view.addSubview(dbys_b)
        dbys_b.snp.makeConstraints { (make) in
            make.top.bottom.equalToSuperview()
            make.right.equalTo(qhsp2.snp.left).offset(-20)
            make.left.equalTo(ys.snp.right).offset(20)
        }
        
        wc_b = UIView.init()
        wc_b.backgroundColor = UIColor.white
        wc_b.isHidden = true
        top_view.addSubview(wc_b)
        wc_b.snp.makeConstraints { (make) in
            make.top.right.bottom.equalToSuperview()
            make.left.equalTo(ys.snp.right)
        }
        
        wc = UILabel.init()
        wc.isUserInteractionEnabled = true
        wc.layer.cornerRadius = 4
        wc.clipsToBounds = true
        wc.text = "完成"
        wc.textColor = UIColor.white
        wc.backgroundColor = UIColor.init(lgf_HexString: "0F88F2")
        wc.font = UIFont.systemFont(ofSize: 13)
        wc.textAlignment = .center
        wc.lgf_AddTap(target: self, action: #selector(BzVC.s_wc(_:)))
        wc_b.addSubview(wc)
        wc.snp.makeConstraints { (make) in
            make.right.equalToSuperview().offset(-25)
            make.height.equalToSuperview().offset(-15)
            make.centerY.equalToSuperview()
            make.width.equalTo(45)
        }
        
        zf = UILabel.init()
        zf.isUserInteractionEnabled = true
        zf.layer.cornerRadius = 4
        zf.clipsToBounds = true
        zf.text = "作废"
        zf.textColor = UIColor.white
        zf.backgroundColor = UIColor.init(lgf_HexString: "CE4C4C")
        zf.font = UIFont.systemFont(ofSize: 13)
        zf.textAlignment = .center
        zf.lgf_AddTap(target: self, action: #selector(BzVC.s_zf(_:)))
        wc_b.addSubview(zf)
        zf.snp.makeConstraints { (make) in
            make.right.equalTo(wc.snp.left).offset(-10)
            make.height.equalToSuperview().offset(-15)
            make.centerY.equalToSuperview()
            make.width.equalTo(45)
        }
        
        qhsp = UILabel.init()
        qhsp.isUserInteractionEnabled = true
        qhsp.layer.borderColor = UIColor.init(lgf_HexString: "8FC6F6")?.cgColor
        qhsp.layer.borderWidth = 1.0
        qhsp.layer.cornerRadius = 4
        qhsp.clipsToBounds = true
        qhsp.text = "切换至SP"
        qhsp.textColor = UIColor.init(lgf_HexString: "0F88F2")
        qhsp.font = UIFont.systemFont(ofSize: 13)
        qhsp.textAlignment = .center
        qhsp.lgf_AddTap(target: self, action: #selector(BzVC.s_qhsp(_:)))
        wc_b.addSubview(qhsp)
        qhsp.snp.makeConstraints { (make) in
            make.right.equalTo(zf.snp.left).offset(-10)
            make.height.equalToSuperview().offset(-15)
            make.centerY.equalToSuperview()
            make.width.equalTo(70)
        }
        
        tzms = UILabel.init()
        tzms.isUserInteractionEnabled = true
        tzms.layer.borderColor = UIColor.init(lgf_HexString: "8FC6F6")?.cgColor
        tzms.layer.borderWidth = 1.0
        tzms.layer.cornerRadius = 4
        tzms.clipsToBounds = true
        tzms.text = "   听诊模式"
        tzms.textColor = UIColor.init(lgf_HexString: "0F88F2")
        tzms.font = UIFont.systemFont(ofSize: 13)
        tzms.lgf_AddTap(target: self, action: #selector(BzVC.s_tzms(_:)))
        wc_b.addSubview(tzms)
        tzms.snp.makeConstraints { (make) in
            make.right.equalTo(qhsp.snp.left).offset(-10)
            make.height.equalToSuperview().offset(-15)
            make.centerY.equalToSuperview()
            make.width.equalTo(90)
        }
        let tzms_i = UIImageView.init(image: #imageLiteral(resourceName: "下拉"))
        tzms.addSubview(tzms_i)
        tzms_i.snp.makeConstraints { (make) in
            make.right.equalToSuperview().offset(-7)
            make.centerY.equalToSuperview()
            make.width.equalTo(8)
            make.height.equalTo(5)
        }
        
        ckbg = UILabel.init()
        ckbg.isUserInteractionEnabled = true
        ckbg.layer.borderColor = UIColor.init(lgf_HexString: "8FC6F6")?.cgColor
        ckbg.layer.borderWidth = 1.0
        ckbg.layer.cornerRadius = 4
        ckbg.clipsToBounds = true
        ckbg.text = "查看报告"
        ckbg.textColor = UIColor.init(lgf_HexString: "0F88F2")
        ckbg.font = UIFont.systemFont(ofSize: 13)
        ckbg.textAlignment = .center
        ckbg.lgf_AddTap(target: self, action: #selector(BzVC.s_ckbg(_:)))
        wc_b.addSubview(ckbg)
        ckbg.snp.makeConstraints { (make) in
            make.right.equalTo(tzms.snp.left).offset(-10)
            make.height.equalToSuperview().offset(-15)
            make.centerY.equalToSuperview()
            make.width.equalTo(70)
        }
        
        ysbz = UILabel.init()
        ysbz.isUserInteractionEnabled = true
        ysbz.layer.borderColor = UIColor.init(lgf_HexString: "FFD5AF")?.cgColor
        ysbz.layer.borderWidth = 1.0
        ysbz.layer.cornerRadius = 4
        ysbz.clipsToBounds = true
        ysbz.text = "医生标注"
        ysbz.textColor = UIColor.init(lgf_HexString: "F27C0F")
        ysbz.font = UIFont.systemFont(ofSize: 13)
        ysbz.textAlignment = .center
        ysbz.lgf_AddTap(target: self, action: #selector(BzVC.s_ysbz(_:)))
        wc_b.addSubview(ysbz)
        ysbz.snp.makeConstraints { (make) in
            make.right.equalTo(ckbg.snp.left).offset(-10)
            make.height.equalToSuperview().offset(-15)
            make.centerY.equalToSuperview()
            make.width.equalTo(80)
        }
        
        ph_view = UIScrollView.init()
        ph_view.delegate = self
        ph_view.showsHorizontalScrollIndicator = false
        ph_view.bounces = false
        if #available(iOS 11.0, *) {
            ph_view.contentInsetAdjustmentBehavior = .never
        } else {
            self.automaticallyAdjustsScrollViewInsets = false
        }
        back_view.addSubview(ph_view)
        ph_view.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(44)
            make.left.equalToSuperview().offset(40)
            make.right.equalToSuperview().offset(-25)
            make.bottom.equalToSuperview().offset(-70)
        }
        
        ph_view_i_top = UIView.init()
        ph_view.addSubview(ph_view_i_top)
        ph_view_i_top.snp.makeConstraints { (make) in
            make.left.equalToSuperview()
            make.top.equalToSuperview()
            make.height.equalTo(15)
            make.width.equalTo(0)
        }
        
        ph_view_i = UIImageView.init(image: nil)
        ph_view_i.backgroundColor = UIColor.black
        ph_view_i.contentMode = .scaleToFill
        ph_view_i.isUserInteractionEnabled = true
        ph_view.addSubview(ph_view_i)
        ph_view_i.snp.makeConstraints { (make) in
            make.left.equalToSuperview()
            make.centerY.equalToSuperview().offset(10)
            make.top.equalTo(ph_view_i_top.snp.bottom)
            make.width.equalTo(1920 * Int(powl(2, 5)) / 2)
        }
        
        ph_l = bzxV.init()
        back_view.addSubview(ph_l)
        ph_l.snp.makeConstraints { (make) in
            make.top.equalTo(ph_view_i).offset(-5)
            make.bottom.equalTo(ph_view).offset(5)
            make.left.equalToSuperview()
            make.right.equalTo(ph_view.snp.left).offset(-5)
        }
        ph_l.bzxList = ["500", "450", "400", "350", "300", "250", "200", "150", "100", "50", "0"]
        
        ph_r = bzxV.init()
        ph_r.font = UIFont.systemFont(ofSize: 9)
        ph_r.textAlignment = .center
        ph_r.textColor = UIColor.white
        back_view.addSubview(ph_r)
        ph_r.snp.makeConstraints { (make) in
            make.top.equalTo(ph_view_i)
            make.bottom.equalTo(ph_view)
            make.right.equalToSuperview()
            make.left.equalTo(ph_view.snp.right)
        }
        ph_r.bzxList = ["0", "dB", "-4", "-8", "-12", "-16", "-20", "-24", "-28", "-32", "-36", "-40", "-44", "-48", "-52", "-56", "-60", "-64"]
        DispatchQueue.main.async {
            let colors = [UIColor.red.cgColor, UIColor.yellow.cgColor, UIColor.green.cgColor, UIColor.blue.cgColor];
            let gradient = CAGradientLayer.init();
            gradient.startPoint = CGPoint.init(x: 0.5, y: 0)
            gradient.endPoint = CGPoint.init(x: 0.5, y: 1)
            gradient.colors = colors;
            gradient.frame = self.ph_r.bounds;
            self.ph_r.layer.insertSublayer(gradient, at: 0)
        }
        
        sp_view = UIView.init()
        sp_view.isHidden = true
        sp_view.backgroundColor = UIColor.darkGray
        ph_view.addSubview(sp_view)
        sp_view.snp.makeConstraints { (make) in
            make.left.equalToSuperview()
            make.centerY.equalToSuperview().offset(10)
            make.top.equalTo(ph_view_i_top.snp.bottom)
            make.width.equalTo(1920 * Int(powl(2, 5)) / 2)
        }
        
        for i in 0..<100 {
            let sp_view_c = LineBackView2.init()
            sp_view_c.backgroundColor = UIColor.clear
            sp_view.addSubview(sp_view_c)
            sp_view_c.snp.makeConstraints { (make) in
                if i == 0 {
                    make.left.equalToSuperview()
                } else {
                    make.left.equalTo(sp_view.subviews[sp_view.subviews.count - 2].snp.right)
                }
                make.top.bottom.equalToSuperview()
                make.width.equalToSuperview().multipliedBy(0.01)
            }
        }
        
        sp_l = bzxV.init()
        sp_l.isHidden = true
        back_view.addSubview(sp_l)
        sp_l.snp.makeConstraints { (make) in
            make.top.equalTo(sp_view)
            make.bottom.equalTo(ph_view)
            make.left.equalToSuperview()
            make.right.equalTo(ph_view.snp.left).offset(-5)
        }
        sp_l.bzxList2 = ["10%", "0%", "-10%"]
        
        let bottom_view = UIView.init()
        back_view.addSubview(bottom_view)
        bottom_view.snp.makeConstraints { (make) in
            make.bottom.left.right.equalToSuperview()
            make.height.equalTo(70)
        }
        
        play_time_all = UILabel.init()
        play_time_all.text = "/00:00"
        play_time_all.textColor = UIColor.init(lgf_HexString: "4E7EA9")
        play_time_all.font = UIFont.systemFont(ofSize: 13)
        bottom_view.addSubview(play_time_all)
        play_time_all.snp.makeConstraints { (make) in
            make.right.equalTo(add_dbys)
            make.top.equalToSuperview().offset(1)
            make.height.equalTo(30)
        }
        
        play_time = UILabel.init()
        play_time.text = "00:00"
        play_time.textColor = UIColor.init(lgf_HexString: "8D969D")
        play_time.font = UIFont.systemFont(ofSize: 13)
        bottom_view.addSubview(play_time)
        play_time.snp.makeConstraints { (make) in
            make.right.equalTo(play_time_all.snp.left)
            make.centerY.equalTo(play_time_all)
        }
        
        play_line = UISlider.init()
        play_line.minimumValue = 0//最小值
        play_line.maximumValue = 1//最大值
        play_line.value = 0 //当前值
        play_line.minimumTrackTintColor = UIColor.init(lgf_HexString: "0F88F2")
        play_line.maximumTrackTintColor = UIColor.init(lgf_HexString: "CFD4D9")
        play_line.thumbTintColor = UIColor.init(lgf_HexString: "0F88F2")
        let thumbImage = #imageLiteral(resourceName: "play_i")
        UIGraphicsBeginImageContextWithOptions(CGSize.init(width: 15, height: 15), false, 0.0)
        thumbImage.draw(in: CGRect.init(x: 0, y: 0, w: 15, h: 15))
        let newThumbImage = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()
        play_line.setThumbImage(newThumbImage, for: .normal)
        play_line.setThumbImage(newThumbImage, for: .selected)
        play_line.setThumbImage(newThumbImage, for: .highlighted)
        play_line.setThumbImage(newThumbImage, for: .focused)
        play_line.addTarget(self, action: #selector(BdjlxqVC.s_end(_:)), for: .touchUpInside)
        play_line.addTarget(self, action: #selector(BdjlxqVC.s_changed(_:)), for: .valueChanged)
        play_line.lgf_AddTap(target: self, action: #selector(BdjlxqVC.s_tap(_:)))
        bottom_view.addSubview(play_line)
        play_line.snp.makeConstraints { (make) in
            make.top.equalToSuperview()
            make.right.equalTo(play_time.snp.left).offset(-12)
            make.left.equalTo(ph_view)
            make.height.equalTo(30)
        }
        
        play_button = UIButton.init(type: .custom)
        play_button.setBackgroundImage(#imageLiteral(resourceName: "bofang"), for: .normal)
        play_button.addTarget(self, action: #selector(BdjlxqVC.playNow(_:)), for: .touchUpInside)
        bottom_view.addSubview(play_button)
        play_button.snp.makeConstraints { (make) in
            make.left.equalTo(ph_view)
            make.top.equalTo(play_line.snp.bottom).offset(2.5)
            make.bottom.equalToSuperview().offset(-7.5)
            make.width.equalTo(30)
        }
        
        let sd = UIView.init()
        sd.lgf_AddTap(target: self, action: #selector(BzVC.s_sd(_:)))
        sd.backgroundColor = UIColor.init(lgf_HexString: "E1F1FF")
        sd.layer.cornerRadius = 12
        bottom_view.addSubview(sd)
        sd.snp.makeConstraints { (make) in
            make.centerY.equalTo(play_button)
            make.left.equalTo(play_button.snp.right).offset(12)
            make.height.equalTo(24)
        }
        let sd_i = UIImageView.init(image: #imageLiteral(resourceName: "倍速@1.5x"))
        sd.addSubview(sd_i)
        sd_i.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(6)
            make.left.equalToSuperview().offset(8)
            make.bottom.equalToSuperview().offset(-6)
            make.width.equalTo(8)
        }
        sd_l = UILabel.init()
        sd_l.text = "x1"
        sd_l.font = UIFont.systemFont(ofSize: 15)
        sd_l.textColor = UIColor.init(lgf_HexString: "0F88F2")
        sd.addSubview(sd_l)
        sd_l.snp.makeConstraints { (make) in
            make.top.bottom.equalToSuperview()
            make.left.equalTo(sd_i.snp.right).offset(8)
            make.right.equalToSuperview().offset(-8)
        }
        
        let sy = UIView.init()
        sy.lgf_AddTap(target: self, action: #selector(BzVC.s_sy(_:)))
        sy.backgroundColor = UIColor.init(lgf_HexString: "E1F1FF")
        sy.layer.cornerRadius = 12
        bottom_view.addSubview(sy)
        sy.snp.makeConstraints { (make) in
            make.centerY.equalTo(play_button)
            make.left.equalTo(sd.snp.right).offset(12)
            make.height.equalTo(24)
        }
        let sy_i = UIImageView.init(image: #imageLiteral(resourceName: "声音@1.5x"))
        sy.addSubview(sy_i)
        sy_i.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(6)
            make.left.equalToSuperview().offset(8)
            make.bottom.equalToSuperview().offset(-6)
            make.width.equalTo(10)
        }
        sy_l = UILabel.init()
        sy_l.text = "x1"
        sy_l.font = UIFont.systemFont(ofSize: 15)
        sy_l.textColor = UIColor.init(lgf_HexString: "0F88F2")
        sy.addSubview(sy_l)
        sy_l.snp.makeConstraints { (make) in
            make.top.bottom.equalToSuperview()
            make.left.equalTo(sy_i.snp.right).offset(8)
            make.right.equalToSuperview().offset(-8)
        }
        
        let xz = UIView.init()
        xz.lgf_AddTap(target: self, action: #selector(BzVC.s_xz(_:)))
        xz.backgroundColor = UIColor.init(lgf_HexString: "E1F1FF")
        xz.layer.cornerRadius = 12
        bottom_view.addSubview(xz)
        xz.snp.makeConstraints { (make) in
            make.centerY.equalTo(play_button)
            make.left.equalTo(sy.snp.right).offset(12)
            make.height.equalTo(24)
        }
        let xz_i = UIImageView.init(image: #imageLiteral(resourceName: "x轴倍数@1.5x"))
        xz.addSubview(xz_i)
        xz_i.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(6)
            make.left.equalToSuperview().offset(8)
            make.bottom.equalToSuperview().offset(-6)
            make.width.equalTo(12)
        }
        xz_l = UILabel.init()
        xz_l.text = "5x"
        xz_l.font = UIFont.systemFont(ofSize: 15)
        xz_l.textColor = UIColor.init(lgf_HexString: "0F88F2")
        xz.addSubview(xz_l)
        xz_l.snp.makeConstraints { (make) in
            make.top.bottom.equalToSuperview()
            make.left.equalTo(xz_i.snp.right).offset(8)
            make.right.equalToSuperview().offset(-8)
        }
        
        yz = UIView.init()
        yz.isHidden = true
        yz.lgf_AddTap(target: self, action: #selector(BzVC.s_yz(_:)))
        yz.backgroundColor = UIColor.init(lgf_HexString: "E1F1FF")
        yz.layer.cornerRadius = 12
        bottom_view.addSubview(yz)
        yz.snp.makeConstraints { (make) in
            make.centerY.equalTo(play_button)
            make.left.equalTo(xz.snp.right).offset(12)
            make.height.equalTo(24)
        }
        let yz_i = UIImageView.init(image: #imageLiteral(resourceName: "Y轴倍数@1.5x"))
        yz.addSubview(yz_i)
        yz_i.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(6)
            make.left.equalToSuperview().offset(8)
            make.bottom.equalToSuperview().offset(-6)
            make.width.equalTo(12)
        }
        yz_l = UILabel.init()
        yz_l.text = "10x"
        yz_l.font = UIFont.systemFont(ofSize: 15)
        yz_l.textColor = UIColor.init(lgf_HexString: "0F88F2")
        yz.addSubview(yz_l)
        yz_l.snp.makeConstraints { (make) in
            make.top.bottom.equalToSuperview()
            make.left.equalTo(yz_i.snp.right).offset(8)
            make.right.equalToSuperview().offset(-8)
        }
        
        // 评分
        pf = UIView.init()
        pf.lgf_AddTap(target: self, action: #selector(BzVC.s_pf(_:)))
        bottom_view.addSubview(pf)
        pf.snp.makeConstraints { (make) in
            make.centerY.equalTo(play_button)
            make.right.equalTo(play_time.snp.right)
            make.width.equalTo(50)
            make.height.equalTo(40)
        }
        let pf_i = UIImageView.init(image: #imageLiteral(resourceName: "评分"))
        pf.addSubview(pf_i)
        pf_i.snp.makeConstraints { (make) in
            make.centerY.left.equalToSuperview()
            make.width.height.equalTo(15)
        }
        let pf_l = UILabel.init()
        pf_l.text = "评分"
        pf_l.font = UIFont.systemFont(ofSize: 15)
        pf_l.textColor = UIColor.init(lgf_HexString: "F27C0F")
        pf.addSubview(pf_l)
        pf_l.snp.makeConstraints { (make) in
            make.top.bottom.right.equalToSuperview()
        }
        
        // 整段标注
        zdbz = UIView.init()
        zdbz.lgf_AddTap(target: self, action: #selector(BzVC.s_zdbz(_:)))
        bottom_view.addSubview(zdbz)
        zdbz.snp.makeConstraints { (make) in
            make.centerY.equalTo(play_button)
            make.right.equalTo(play_time.snp.right).offset(0)
            make.width.equalTo(85)
            make.height.equalTo(40)
        }
        let zdbz_i = UIImageView.init(image: #imageLiteral(resourceName: "整段标注@1.5x"))
        zdbz.addSubview(zdbz_i)
        zdbz_i.snp.makeConstraints { (make) in
            make.centerY.left.equalToSuperview()
            make.width.height.equalTo(15)
        }

        let zdbz_l = UILabel.init()
        zdbz_l.text = "整段标注"
        zdbz_l.font = UIFont.systemFont(ofSize: 15)
        zdbz_l.textColor = UIColor.init(lgf_HexString: "0F88F2")
        zdbz.addSubview(zdbz_l)
        zdbz_l.snp.makeConstraints { (make) in
            make.top.bottom.right.equalToSuperview()
        }
        
        // 框选标注
        kxbz = UIView.init()
        kxbz.lgf_AddTap(target: self, action: #selector(BzVC.s_kxbz(_:)))
        bottom_view.addSubview(kxbz)
        kxbz.snp.makeConstraints { (make) in
            make.centerY.equalTo(play_button)
            make.right.equalTo(zdbz.snp.left).offset(-30)
            make.width.equalTo(85)
            make.height.equalTo(40)
        }
        let kxbz_i = UIImageView.init(image: #imageLiteral(resourceName: "框选标注@1.5x"))
        kxbz.addSubview(kxbz_i)
        kxbz_i.snp.makeConstraints { (make) in
            make.centerY.left.equalToSuperview()
            make.width.height.equalTo(15)
        }

        kxbz_l = UILabel.init()
        kxbz_l.text = "框选标注"
        kxbz_l.font = UIFont.systemFont(ofSize: 15)
        kxbz_l.textColor = UIColor.init(lgf_HexString: "0F88F2")
        kxbz.addSubview(kxbz_l)
        kxbz_l.snp.makeConstraints { (make) in
            make.top.bottom.right.equalToSuperview()
        }
        
    }
    
}

class dbysV: UIView {
    
    var ys: UIView!
    var mz: UILabel!
    var bzModel: BzModel!
    var select: ((BzModel) -> Void)?
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        ys = UIView.init()
        ys.layer.cornerRadius = 4
        addSubview(ys)
        ys.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.left.equalTo(8)
            make.width.height.equalTo(8)
        }
        
        let sc_b = UIView.init()
        sc_b.lgf_AddTap(target: self, action: #selector(dbysV.s_select))
        addSubview(sc_b)
        sc_b.snp.makeConstraints { (make) in
            make.top.bottom.right.equalToSuperview()
            make.width.equalTo(30)
        }
        
        mz = UILabel.init()
        mz.text = ""
        mz.textAlignment = .center
        mz.font = UIFont.systemFont(ofSize: 14)
        mz.textColor = UIColor.init(lgf_HexString: "222222")
        addSubview(mz)
        mz.snp.makeConstraints { (make) in
            make.left.equalTo(ys.snp.right).offset(8)
            make.right.equalToSuperview().offset(-8)
            make.centerY.equalToSuperview()
        }
        
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    @objc func s_select() {
        select?(bzModel)
    }
    
}

class bzxV: UIView {
    
    var textAlignment: NSTextAlignment!
    var font: UIFont!
    var textColor: UIColor!
    
    var bzxList: [String]! {
        didSet {
            if bzxList != nil {
                bzxList.forEach { (v) in
                    let num_l = UILabel.init()
                    num_l.text = v
                    num_l.textAlignment = textAlignment
                    num_l.font = font
                    num_l.textColor = textColor
                    addSubview(num_l)
                    var ff: Double = 0.0
                    if ((10.0 / CGFloat(bzxList.count)) > 1) {
                        ff = Double((10.0 / CGFloat(bzxList.count) - 1))
                    } else {
                        ff = Double((10.0 / CGFloat(bzxList.count)))
                    }
                    num_l.snp.makeConstraints { (make) in
                        make.height.equalToSuperview().multipliedBy(ff / 10.0)
                        if subviews.count > 1 {
                            make.top.equalTo(subviews[subviews.count - 2].snp.bottom)
                        } else {
                            make.top.equalTo(0)
                        }
                        make.left.right.equalToSuperview()
                    }
                }
            }
        }
    }
    
    var bzxList2: [String]! {
        didSet {
            if bzxList2 != nil {
                if bzxList2.count >= 3 {
                    for (i, v) in bzxList2.enumerated() {
                        let num_l = UILabel.init()
                        num_l.text = v
                        num_l.textAlignment = textAlignment
                        num_l.font = font
                        num_l.textColor = textColor
                        addSubview(num_l)
                        num_l.snp.makeConstraints { (make) in
                            make.left.right.equalToSuperview()
                            if i == 0 {
                                make.top.equalToSuperview()
                            } else if i == 1 {
                                make.centerY.equalToSuperview()
                            } else if i == 2 {
                                make.bottom.equalToSuperview()
                            }
                        }
                    }
                }
            }
        }
    }
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        textAlignment = .right
        font = UIFont.systemFont(ofSize: 12)
        textColor = UIColor.init(lgf_HexString: "8D969D")
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}

